
function doXMLHttpRequest(request_url) {                      
	if (window.XMLHttpRequest) { // Object of the current window
	      xhr = new XMLHttpRequest(); // Firefox, Safari, ...
      } else if (window.ActiveXObject) { // ActiveX version
            xhr = new ActiveXObject("Microsoft.XMLHTTP"); // Internet Explorer 
	}
                
      xhr.onreadystatechange = function() {    
      	if (xhr.readyState == 4) {
            	// Received, OK
                  document.getElementById('loctext').innerHTML=xhr.responseText     
            } else {
                  // Wait...
            }
      };   
	xhr.open('GET', request_url,  true);
      xhr.setRequestHeader('Cache-Control','private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
      xhr.setRequestHeader('Pragma', 'no-cache');
      xhr.send(null);                
}

function revealModal(divID)
{
    window.onscroll = function () { document.getElementById(divID).style.top = document.body.scrollTop; };
    document.getElementById(divID).style.display = "block";
    document.getElementById(divID).style.top = document.body.scrollTop;

    posleft = document.documentElement.clientWidth/2 - 110;
    document.getElementById("modalContainer").style.left = posleft + "px";
    postop = document.documentElement.clientHeight/2 - 110;
    document.getElementById("modalContainer").style.top = postop + "px";

    // set location
    doXMLHttpRequest("http://" + window.location.host + "/reversegeo.php?lon=" + 
	document.getElementById('input_lon').value + "&lat=" + document.getElementById('input_lat').value);

//select text in textarea
	document.getElementById("messageBox").select()	

}

function hideModal(divID)
{
    document.getElementById(divID).style.display = "none";
}


